<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<style type="text/css">
	#background{
		width: 1115px;
	    height: 565px;
	    margin: 0px auto;
	    margin-top: 12px;
	    background-color: #FFF;
	}
</style>
<script type="text/javascript">
	$(function(){
		var input = document.getElementById("file-g");
		//文件域选择文件时, 执行readFile函数
		input.addEventListener('change',readFile,false);
		function readFile(){
			var file = this.files[0];
			if(file==null){
				document.getElementById("row-file-img").setAttribute("src","");
			}else{
				if(file.name.split(".")[1]=="png"||file.name.split(".")[1]=="jpg"){
					if(file.size<1048576){
						 $("#job-modal-form").form('submit',{
							 url:'myimg',
							 async:false,
							 success:function(data){
								 alert(data)
								 document.getElementById("row-file-img").setAttribute("src",data);
							}
						 });
					}
				}
			}
		}
		$("#job-modal-form").form('submit',{
			url:'myimg'
		})
	});
</script>
<div id="background">
	<form id="job-modal-form"  method="post" enctype="multipart/form-data">
			<label for="avatarInput">本地上传	</label>
			<input type="file" id="file-g" name="fileImage" >
			<img id="row-file-img" src="">
	</form>
</div>
</body>
</html>